package com.csmall.cart.webapi.mapper;

import com.csmall.commons.pojo.cart.entity.Cart;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

/**
 * @Name: CartMapper
 * @Author: 西风残叶
 * @Date: 2024/8/18 17:58
 * @Version: 1.0
 * @TODO: TODO
 */
@Repository
public interface CartMapper {
    @Insert("insert into cart_tbl(commodity_code,price,count,user_id) values" +
            "(#{commodityCode},#{price},#{count},#{userId})")
    int insertCart(Cart cart);
    @Delete("delete from cart_tbl where user_id=#{userId} and " +
            " commodity_code=#{commodityCode}")
    int deleteCartByUserIdAndCommodityCode(
            @Param("userId") String userId,
            @Param("commodityCode") String commodityCode);
}